Usage

To use the Rail package in your LATEX document you need to include the rail style option in the document's preamble, like It is usually best to put the rail option last. Then you can display diagrams in your document body by using where the syntax of rules is given in Figures [*] and [*], as a railroad diagram. There are also various options you can set in the preamble.

Figure: Input syntax for Rail
\begin{figure}\begin{rail}
\par
rules : ( rule ? + ';' ) ;
\par
rule : ( identifier ':' ) ? body[1--5] ;
\par
\end{rail}
\end{figure}

Figure: Input syntax for Rail, continued
\begin{figure}\begin{rail}
\par
body : [1] ( ( '[' string ']' ) ? body[2--6] + '...
... [5] '(' body[1--6] ')'
\vert [5] cr
\vert [6]
;
\par
\end{rail}
\end{figure}

After running your file.tex through LATEX, a file named file.rai will have been created, containing all the rules from your document. This file must then be processed with the rail program to produce file.rao containing LATEX formatting instructions for each diagram This is done with the command On the next LATEX run, the diagrams will be picked up and integrated into the output. If the diagrams in file.rao are not up-to-date with your LATEX file, the rail package will detect this and warn you with for each diagram, and again at the end of the document with The number between braces can be used to find the diagram in file.rai or file.rao if needed.